package com.lglbc.springbootlearning.config;

import com.lglbc.springbootlearning.helper.TestHelper;
import org.jasypt.encryption.StringEncryptor;
import org.jasypt.util.text.BasicTextEncryptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.List;

@Configuration
public class TestConfiguration {
@Autowired
private StudentConfig studentConfig;
    @Value("${student.name}")
    private String name;
    @Value("${mysql.username}")
    private String username;
    @Value("${mysql.password}")
    private String password;
    @Autowired
    private StringEncryptor stringEncryptor;
    @Bean
    public TestHelper testHelper(){
        System.out.println(name);
        System.out.println(studentConfig.getProvince().toString()+studentConfig.getName());
//        System.out.println(stringEncryptor.encrypt("root"));
//        System.out.println(stringEncryptor.encrypt("root"));
        BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
//        //加密所需的salt(盐)
        textEncryptor.setPassword("123456");
        //要加密的数据（数据库的用户名或密码）
//        String username = stringEncryptor.encrypt("root");
//        String password = stringEncryptor.encrypt("root");
        System.out.println("username:"+username);
        System.out.println("password:"+password);
        return new TestHelper();
    }
}
